package Z06XianCheng.XC03TongBu;


public class Hero {
    public String name;
    public float hp;

    public int damage;

    public void AttackHero(Z06XianCheng.XC01StartXianCheng.Hero h){


         try {
                Thread.sleep(1000);
             }catch (InterruptedException e ){
                 e.printStackTrace();
             }

        h.hp -= damage;
        System.out.printf("%s 正在攻击 %s, %s的血变成了 %.0f%n",name,h.name,h.name,h.hp);

        if (h.isDead()){
            System.out.println(h.name + "没了！");
        }


    }

    public boolean isDead() {
        return 0 >= hp ? true:false;
    }

    public void recover(){
        hp += 1;
    }

    public void hurt(){
        hp -= 1;
    }
}
